Stabilize Euclidean MTT distances at extreme scales - #4968
Conversation
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
|
Closing as low value/incomplete. It targets Euclidean MTT coordinates near the float64 limit (around 1e308), outside a practical tracking regime, while replacing the reduction without an |

Summary
numpy.hypot.reduceinstead ofnumpy.linalg.normfloat64limitBug
_euclidean_mtt_distance()formed finite displacement vectors and evaluated them withnumpy.linalg.norm. For a displacement such as[1e308, 1e308], the mathematically correct norm is approximately1.4142e308and is still representable, butnumpy.linalg.normsquares the components internally and overflows to infinity.With a cutoff of
1.5e308, the overflow caused the pairwise cost to be clipped to1.5e308, overstating the localization error. Undernumpy.errstate(over="raise"), the same valid input raisedFloatingPointError.Fix
Use
numpy.hypot.reduce(..., axis=2), which accumulates Euclidean norms with scale-aware arithmetic and returns the correct finite value without an overflowing square.Validation
1.5e308after erroneous cutoff clipping1.4142135623730951e308numpy.errstate(over="raise", invalid="raise")tests/evaluation/test_euclidean_mtt_distance_orientation.pymain; the diff contains only the implementation line and focused testFull repository tests were not run locally because this environment could not resolve GitHub for a checkout; GitHub Actions should exercise the in-tree regression and full matrix.